package com.develophelper.example.tkmapper.runner;

import com.develophelper.example.tkmapper.domain.handler.UserHandler;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author snaildev
 * @date 2020/12/04
 **/
@Slf4j
@Component
public class UserRunner implements ApplicationRunner {

    @Resource
    UserHandler userHandler;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
        log.info(gson.toJson(userHandler.selectByPrimaryKey(1)));
    }
}
